f5199f0fca1148140fec1e89fff660de394344eb,tools/src/main/java/com/orientechnologies/orient/stresstest/workload/OCRUDWorkload.java,OCRUDWorkload,execute,#number#ODatabaseIdentifier#,101
Before Change
for (int i = 0; i < creates; ++i)
records.add(null);
createsResult = executeOperation(databaseIdentifier, creates, concurrencyLevel, new OCallable<Void, OWorkLoadContext>() {
@Override
public Void call(final OWorkLoadContext context) {
final ODocument doc = createOperation(context.currentIdx);
synchronized (records) {
if (records.set(context.currentIdx, doc.getIdentity()) != null)
throw new RuntimeException(
"Error on creating record with id " + context.currentIdx + " because has been already created");
}
currentCreates.incrementAndGet();
return null;
}
});
if (records.size() != creates)
throw new RuntimeException("Error on creating records: found " + records.size() + " but expected " + creates);
After Change
for (int i = 0; i < createsResult.total; ++i)
records.add(null);
executeOperation(databaseIdentifier, createsResult.total, concurrencyLevel, new OCallable<Void, OBaseWorkLoadContext>() {
@Override
public Void call(final OBaseWorkLoadContext context) {
final ODocument doc = createOperation(context.currentIdx);
synchronized (records) {
if (records.set(context.currentIdx, doc.getIdentity()) != null)
throw new RuntimeException(
"Error on creating record with id " + context.currentIdx + " because has been already created");
}
createsResult.current.incrementAndGet();
return null;
}
});
if (records.size() != createsResult.total)
throw new RuntimeException("Error on creating records: found " + records.size() + " but expected " + createsResult.total);